import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/course' },
    { path: '/404', component: () => import('@/components/404.vue') },
    { path: '/:pathMatch(.*)*', redirect: '/404' },

    // 后台
    {
      path: '/home',
      component: () => import('@/views/Home.vue'),
      children: [
        { path: '/home/course', component: () => import('@/views/back/Course.vue') },
        { path: '/home/order', component: () => import('@/views/back/Order.vue') },
        { path: '/home/download', component: () => import('@/views/back/Download.vue') },
      ]
    },
  ]
})

export default router